/**
 * [一句话描述该类的功能]
 *
 * @author : [kai]
 * @version : [v1.0]
 * @createTime : [2022/11/19 19:24]
 */


package com.example.redisdemo.util;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisConnectionFactory {
    private static final JedisPool jedisPool;
    static{
        JedisPoolConfig poolConfig=new JedisPoolConfig();
        poolConfig.setMaxTotal(8);
        poolConfig.setMaxIdle(8);
        poolConfig.setMaxIdle(2);
        poolConfig.setMaxWaitMillis(1000);
        jedisPool=new JedisPool(poolConfig,"192.168.80.129",6379,1000,"chuanzhi");

    }

    public static Jedis getJedis(){
        return jedisPool.getResource();
    }
}
